#pragma once

#include <pybind11/pybind11.h>
#include <optional>
#include <utility>
#include "yj_return.hpp"

namespace py = pybind11;

class camera
{
public:
    typedef enum
    {
        camera_color_red = 1,
        camera_color_green = 2,
        camera_color_blue = 3,
    } camera_color_en;

private:
    py::object camera_instance;
    py::object py_module;
    bool initialized;

    // 初始化Python环境和模块
    void init_python();

public:
    // 构造函数
    camera(int camera_id = 0);

    // 析构函数
    ~camera();

    // 获取指定颜色物体的中心坐标
    std::optional<std::pair<int, int>> get_center(camera_color_en color);
    int get_color(int area = 400);
    std::optional<int> take_pic(int name = 0);
    double get_angle();

    yj_return is_move(int color);
    // 释放资源
    void release();
};
